/*!
\copyright  Copyright (c) 2024 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\ingroup    audio_domain
\brief      32bit Q Format conversion functions

*/

#include "q_format.h"

#define UINT32_SIZE (32)

uint32 QFormat_ConvertUintToQFormat(const uint8 N, const uint32 value)
{
    uint8 M = 0;
    if (N <= UINT32_SIZE)
    {
        M = (uint8)((uint8)UINT32_SIZE - N);
    }
    return value << M;    
}

uint32 QFormat_ConvertQFormatToUint(const uint8 N, const uint32 value)
{
    uint8 M = 0;
    if (N <= UINT32_SIZE)
    {
        M = (uint8)((uint8)UINT32_SIZE - N);
    }
    return value >> M;
}